Skip to content

all: support for Go 1.27#5477

Open
deadprogram wants to merge 9 commits into
devfrom
go1.27-ci
Open

all: support for Go 1.27#5477
deadprogram wants to merge 9 commits into
devfrom
go1.27-ci

Conversation

@deadprogram

@deadprogram deadprogram commented Jun 25, 2026

Copy link
Copy Markdown
Member

This PR is to add support for Go 1.27

Current passes tests on 1.27-rc2

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Size difference with the dev branch:

Binary size difference
drivers/sizes-dev.txt has more commands than drivers/sizes-pr.txt
    tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/adafruit4650
 flash                          ram
 before   after   diff          before   after   diff

@deadprogram

Copy link
Copy Markdown
Member Author

Added another commit with support for the new //go:linknamestd directive that is new in Go 1.27

@deadprogram

Copy link
Copy Markdown
Member Author

It got further. I think perhaps the new set of errors might have to do with the SSA changes for generics we were just discussing @jakebailey @aykevl

/home/runner/go/bin/tinygo test -target=wasip1 -skip='TestExtraMethods|TestParseAndBytesRoundTrip/P256/Generic|TestAsValidation' cmp compress/lzw compress/zlib container/heap container/list container/ring crypto/ecdsa crypto/elliptic crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 database/sql/driver debug/macho embed/internal/embedtest encoding encoding/ascii85 errors encoding/asn1 encoding/base32 encoding/base64 encoding/csv encoding/hex expvar go/ast go/format go/scanner go/token go/version hash hash/adler32 hash/crc64 hash/fnv html internal/itoa internal/profile math math/cmplx net/http/internal/ascii net/mail net/url os path reflect sync testing testing/iotest text/scanner unicode unicode/utf16 unicode/utf8 unique  ./tests/runtime_wasi
ok  	cmp	1.389s
ok  	compress/lzw	1.318s
panic: expected nil interface constant

goroutine 1702 [running]:
github.com/tinygo-org/tinygo/compiler.(*compilerContext).createConst(0x36af075d1320, 0x36aeff5398a0, 0x2dc853)
	/__w/tinygo/tinygo/compiler/compiler.go:3149 +0xf65
github.com/tinygo-org/tinygo/compiler.(*builder).getValue(0x36af07de0a80, {0xa0a3c8?, 0x36aeff5398a0}, 0x36af07d870e8?)
	/__w/tinygo/tinygo/compiler/compiler.go:2116 +0xb8
github.com/tinygo-org/tinygo/compiler.(*builder).createExpr(0x36af07de0a80, {0xa0a800, 0x36af07acee70})
	/__w/tinygo/tinygo/compiler/compiler.go:2202 +0x1a46
github.com/tinygo-org/tinygo/compiler.(*builder).createInstruction(0x36af07de0a80, {0xa0b388, 0x36af07acee70})
	/__w/tinygo/tinygo/compiler/compiler.go:1514 +0xd9f
github.com/tinygo-org/tinygo/compiler.(*builder).createFunction(0x36af07de0a80)
	/__w/tinygo/tinygo/compiler/compiler.go:1398 +0x4c5
github.com/tinygo-org/tinygo/compiler.(*compilerContext).createPackage(0x36af075d1320, {0x36aefb24f600?}, 0x36aef73e7d00)
	/__w/tinygo/tinygo/compiler/compiler.go:934 +0x945
github.com/tinygo-org/tinygo/compiler.CompilePackage({0x36af0baaeb00?, 0x5a?}, 0x36aef8f9ba40, 0x36aef73e7d00, {0x83f05cdfec64b02a?}, 0xdf8308?, 0xe4?)
	/__w/tinygo/tinygo/compiler/compiler.go:334 +0x445
github.com/tinygo-org/tinygo/builder.Build.func3(0x36af06bab680)
	/__w/tinygo/tinygo/builder/build.go:405 +0x1ea
github.com/tinygo-org/tinygo/builder.runJob(0x36af06bab680, 0x36aefd3efdc0)
	/__w/tinygo/tinygo/builder/jobs.go:212 +0x4d
created by github.com/tinygo-org/tinygo/builder.runJobs in goroutine 1582
	/__w/tinygo/tinygo/builder/jobs.go:113 +0x6c9
make: *** [GNUmakefile:533: tinygo-test-wasip1-fast] Error 2

@deadprogram

Copy link
Copy Markdown
Member Author

Added another commit that updates x/tools to a newer version that handles the new generics changes. The consequence of this is that the new minimum version of Go for TinyGo is 1.25, which is something that we also discussed in the monthly meeting.

@jakebailey

Copy link
Copy Markdown
Member

For Windows, seems like you need the chkstk.S change for more platforms.

I think TestBuild/EmulatedCortexM3 is unavoidable, new json v2 is just larger.

@jakebailey

Copy link
Copy Markdown
Member

I think I actually have all of the other failures figured out, but, not sure what to do with the fixes.

One or two of them I can send to dev first. E.g. when I added recover support, I totally forgot to also enable FailNow and SkipNow, and that's what some of the failure is.

Comment thread src/runtime/runtime_windows_go126.go Outdated
@deadprogram deadprogram changed the title all: build/test using Go 1.27-rc1 all: build/test using Go 1.27-rc2 Jul 8, 2026
Comment thread builder/builtins.go Outdated
@jakebailey jakebailey force-pushed the go1.27-ci branch 3 times, most recently from cfcf9cd to db17b48 Compare July 8, 2026 17:47
@deadprogram

Copy link
Copy Markdown
Member Author

@jakebailey I just overwrote your commits that you had already added to this branch by force puching without having pulled your changes to my local branch first. Sorry about that, my bad :(

Can you help get them back in please?

@jakebailey

Copy link
Copy Markdown
Member

I don't have the ability to for a few days but you can download these and git apply them

@deadprogram

Copy link
Copy Markdown
Member Author

@jakebailey thanks! Just ammended this PR with those 2 commits...

@deadprogram

Copy link
Copy Markdown
Member Author

Looks like the test failures so far are perhaps related to crypto/ecdsa.

@jakebailey

Copy link
Copy Markdown
Member

Yeah, I couldn't figure those out as they did not reproduce locally

@deadprogram

Copy link
Copy Markdown
Member Author

Actually it seems like it was compress/flate. Skipping for now to see if other tests pass.

@jakebailey

Copy link
Copy Markdown
Member

That last commit reminds me of #5508

@deadprogram

Copy link
Copy Markdown
Member Author

That last commit reminds me of #5508

Indeed, it looks like #5508 is a better version of the same idea.

@deadprogram

deadprogram commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

#5508 was merged, then I removed my commit from this branch and rebased in the latest dev

@deadprogram

Copy link
Copy Markdown
Member Author

Looks like I needed a version of that commit after all to handle the float32/float64 difference.

@deadprogram deadprogram marked this pull request as ready for review July 11, 2026 20:29
@deadprogram

Copy link
Copy Markdown
Member Author

All tests passing (except for a couple that were skipped).

@deadprogram deadprogram changed the title all: build/test using Go 1.27-rc2 all: support for Go 1.27-rc2 Jul 11, 2026
@dkegel-fastly dkegel-fastly requested a review from Copilot July 11, 2026 23:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates TinyGo’s toolchain/CI integration and compiler behavior to work with Go 1.27-rc2, including new Go 1.27 language/tooling patterns and platform/test adjustments.

Changes:

  • Bump supported Go minor range (min 1.25, max 1.27) and update CI/Docker to Go 1.27.0-rc.2.
  • Fix generic instantiation name collisions caused by function-local type aliases (Go 1.27 internal/strconv pattern) and add coverage in testdata/localtypes.
  • Add support for //go:linknamestd, adjust Windows runtime library/builtins selection, and tweak WASI fast stdlib test package selection.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
testdata/localtypes.txt Adds expected outputs for new alias-size regression checks.
testdata/localtypes.go Adds a regression reproducer for Go 1.27’s function-local type alias generic pattern.
src/runtime/os_darwin_go126.go Adjusts build tags to include Go 1.27.
main_test.go Adds Go-minor-based test skipping for a size-constrained target on Go 1.27+.
go.mod Updates Go language version directive and bumps x/* dependencies.
go.sum Updates checksums for the bumped x/* dependencies.
GNUmakefile Disables problematic stdlib tests and refines WASI “fast” package set.
Dockerfile Updates build container images to Go 1.27rc2.
compiler/testdata/pragma.ll Extends pragma IR test fixture for linknamestd.
compiler/testdata/pragma.go Adds a test case using //go:linknamestd.
compiler/symbol.go Disambiguates local type-alias instantiations and recognizes //go:linknamestd.
compileopts/target.go Ensures Windows/amd64 and Windows/arm64 select compiler-rt.
builder/sizes_test.go Updates expected binary size baselines.
builder/config.go Updates supported Go minor range to include Go 1.27 and raise minimum to 1.25.
builder/builtins.go Adds Windows chkstk builtins for amd64/arm64 and refines Windows triple detection.
.github/workflows/windows.yml Updates CI to Go 1.27.0-rc.2 and refreshes caches/wasmtime.
.github/workflows/linux.yml Updates CI/container images to Go 1.27rc2 and refreshes caches/wasmtime.
.github/workflows/compat.yml Updates minimum-compat Go version to 1.25.
.github/workflows/build-macos.yml Updates CI to Go 1.27.0-rc.2 and refreshes cache keys.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@deadprogram deadprogram changed the title all: support for Go 1.27-rc2 all: support for Go 1.27 Jul 12, 2026
@deadprogram

Copy link
Copy Markdown
Member Author

I have moved 2 of the commits in the PR into #5514 and #5515 so they can be merged sooner and to cleanup the commits in this PR.

deadprogram and others added 9 commits July 12, 2026 14:19
Signed-off-by: deadprogram <ron@hybridgroup.com>
Signed-off-by: deadprogram <ron@hybridgroup.com>
Go 1.27 adds generic methods (golang/go#77273). golang.org/x/tools
go/ssa v0.42.0 does not instantiate them: objectMethod only applies
receiverTypeArgs and ignores method-level type parameters, so a call
such as (*math/rand/v2.Rand).N resolves to the abstract generic method
and its body reaches createConst with a type-parameter-typed zero
constant, triggering "panic: expected nil interface constant".

Upgrade golang.org/x/tools to v0.47.0, whose go/ssa returns nil from
MethodValue for generic methods and instantiates method-level type
parameters. No compiler changes are required.

Since x/tools v0.47.0 requires Go 1.25, raise the minimum supported Go
version from 1.24 to 1.25.

Signed-off-by: deadprogram <ron@hybridgroup.com>
Go 1.27 packages can emit stack probes on Windows amd64 and arm64.
Link the compiler-rt stack probe builtins and use compiler-rt for those
targets so these packages build.
Go 1.27 jsonv2 pushes testdata/json.go beyond the LM3S6965 flash
budget. Keep coverage on larger emulated targets while skipping only the
too-small Cortex-M QEMU configuration.
Signed-off-by: deadprogram <ron@hybridgroup.com>
Signed-off-by: deadprogram <ron@hybridgroup.com>
Signed-off-by: deadprogram <ron@hybridgroup.com>
…ases

x/tools go/ssa names instantiations using the type argument's String().
Function-local aliases like `type F = float64` therefore collide when two
callers use distinct aliases named F (Go 1.27's internal/strconv.ftoa32
and ftoa64 do exactly this). Extend localTypeArgsSuffix to detect local
aliases and include their declaration position, so the float32 and
float64 instantiations get distinct LLVM symbols.

Fixes wrong float formatting in strconv/math on Go 1.27, and adds a
regression test to testdata/localtypes.go.

Signed-off-by: deadprogram <ron@hybridgroup.com>
@deadprogram

Copy link
Copy Markdown
Member Author

Cleaned up commits a bit and also rebased against dev.

#5514 was merged, #5515 is still pending feedback so I left it in this PR still so tests could pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants